#pragma once
#include "GameObject.h"
#include <list>

class Item : public GameObject {
protected:
	int m_weight;
	bool m_statusIdentified;
	Status m_status;
	bool m_equipped;
	EquipmentLocation m_equipLocation;
	bool m_stackable;
	int m_numStacked;
	std::list<Item*>* m_parentList;
public:
	Item(GenericType type, Status m_status = UNCURSED);
	Item(GenericType type, std::ifstream& file);
	virtual ~Item();
	int getWeight() const;
	virtual void logDetails(TextLog& log) const;
	virtual int getRandomDamage() const;
	bool isEquipped() const;
	void setIsEquipped(bool equipped, EquipmentLocation location);
	Status getStatus() const;
	bool isIdentified() const;
	bool isStatusIdentified() const;
	virtual void identify();
	void statusIdentify();
	void setStatus(Status status, bool overwrite = false);
	std::string getColoredName() const;
	std::string getColoredBasicName() const;
	virtual std::string getName() const;
	virtual std::string getItemName(int mod = 0) const;
	virtual std::string getColoredItemName(int mod = 0) const;
	bool isStackable() const;
	int getNumStacked() const;
	virtual void addToStack(Item* item);
	virtual void reduceStackCount(int num, bool destroy = false, std::list<Item*>* items = NULL);
	std::string getPluralName() const;
	void setParentList(std::list<Item*>* list);
	std::list<Item*>* getParentList() const;
	virtual bool specialEqual(Item* item) const;
	virtual void save(std::ofstream& file) const;
	EquipmentLocation getEquipLocation() const;
};

inline int Item::getWeight() const {return m_weight*m_numStacked;}
inline bool Item::isEquipped() const {return m_equipped;}
inline void Item::setIsEquipped(bool equipped, EquipmentLocation location) {m_equipped = equipped; m_equipLocation = location;}
inline Status Item::getStatus() const {return m_status;}
inline bool Item::isStatusIdentified() const {return m_statusIdentified;}
inline void Item::addToStack(Item* item) {m_numStacked += item->getNumStacked();}
inline bool Item::isStackable() const {return m_stackable;}
inline int Item::getNumStacked() const {return m_numStacked;}
inline void Item::setParentList(std::list<Item*>* list) {m_parentList = list;}
inline std::list<Item*>* Item::getParentList() const {return m_parentList;}
inline bool Item::specialEqual(Item* item) const {return true;}
inline EquipmentLocation Item::getEquipLocation() const {return m_equipLocation;}
